package com.project.im.web.filter;

import com.project.im.app.dto.WebUserDetails;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

public class WebUserAuthenticationToken extends AbstractAuthenticationToken {

    private final WebUserDetails principle;


    public WebUserAuthenticationToken(WebUserDetails principle, Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
        this.principle = principle;
        super.setAuthenticated(true);
    }

    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return this.principle;
    }
}
